echo "停服务"

dev_path="/mnt/bbs/api/"
server_name="bbs-api"
 
supervisorctl stop "$server_name"

# 配置文件
echo "复制配置文件"

cp -f bbs-go.test.yaml "$dev_path"/bbs-go.dev.yaml

echo "编译文件"  
GOOS=linux GOARCH=amd64 go build -o "$server_name" main.go

echo "复制文件"  
cp "$server_name" "$dev_path"

echo "启动服务"
supervisorctl start "$server_name"

rm -f "$server_name"

echo "发布成功"